package com.stylefeng.guns;

import com.stylefeng.guns.modular.rocketmq.RocketMQConsumer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

@Configuration
@WebListener
public class MyListenerOnServlet implements ServletContextListener {

    @Autowired
    private RocketMQConsumer rocketMQConsumer;



    @Override  
    public void contextInitialized(ServletContextEvent servletContextEvent) {
        System.out.println("ServletContext容器初始化了。。。");  

        rocketMQConsumer.defaultMQPushConsumer();


    }  
  
    @Override  
    public void contextDestroyed(ServletContextEvent servletContextEvent) {  
        System.out.println("ServletContext容器销毁了。。。");  
    }  
  
}  